bencher 0.1.5

A port of the libtest (unstable Rust) benchmark runner to Rust stable releases. Supports running benchmarks and filtering based on the name. Benchmark execution works exactly the same way and no more (caveat: black_box is still missing!).
Documentation

Simplified stable-compatible benchmark runner.

Almost all user code will only be interested in Bencher and the macros that are used to describe benchmarker functions and the benchmark runner.

NOTE: There's no proper black_box yet in this stable port of the benchmark runner, only a workaround implementation. It may not work exactly like the upstream test::black_box.

One way to use this crate is to use it as dev-dependency and setup cargo to compile a file in benches/ that runs without the testing harness.

In Cargo.toml:

[[bench]]
name = "example"
harness = false

In benches/example.rs:

#[macro_use]
extern crate bencher;

use bencher::Bencher;

fn a(bench: &mut Bencher) {
    bench.iter(|| {
        (0..1000).fold(0, |x, y| x + y)
    })
}

fn b(bench: &mut Bencher) {
    const N: usize = 1024;
    bench.iter(|| {
        vec![0u8; N]
    });

    bench.bytes = N as u64;
}

benchmark_group!(benches, a, b);
benchmark_main!(benches);

# #[cfg(never)]
# fn main() { }

Use cargo bench as usual. A command line argument can be used to filter which benchmarks to run.